package guet.dream.servlet;

import guet.dream.question.Question;
import guet.dream.question.QuestionDao;
import guet.dream.question.QuestionDaoImpl;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class IndexServlet extends HttpServlet {

	private static final long serialVersionUID = 8386141186735972877L;
	
	@Override
	public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException{
		QuestionDao questionDao = new QuestionDaoImpl();
		List<Question>  questions = questionDao.findAll();
		
		request.setAttribute("questions", questions);
		
		RequestDispatcher view = request.getRequestDispatcher("index.jsp");

	   view.forward(request, response);	
	}//eend doGet

}
